package cn.java76.spring1.aop;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Arrays;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class AopTest1 {
    public static void main(String[] args) {
        ApplicationContext ac=new ClassPathXmlApplicationContext("aop.xml");
        //动态生成一个代理类，继承于StudentService,重写add方法
        StudentService bean = ac.getBean(StudentService.class);
        int r=bean.add(new Student(15L,"汪开轩","13555555555"));
        System.out.println("保存成功了？"+r);
        //反射获得他的信息
        Class c=bean.getClass();
        System.out.println("名字:"+c.getName());
        System.out.println("父类："+c.getSuperclass());
        System.out.println("接口："+ Arrays.toString(c.getInterfaces()));


        List<Student> all = bean.findAll();
        System.out.println("找到了"+all);


    }
}
